﻿Public Class pendientest
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub ASPxButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ASPxButton1.Click

        Try
            Dim fecha As String
            fecha = Date.Today.ToString("dd/MM/yyyy")
            Dim userid As String = 1 'seguridad.usuarioid1.ToString
            Dim Solicitudid As Integer = ASPxGridView1.GetRowValues(ASPxGridView1.FocusedRowIndex, ("solicitudid"))
            Dim tablaasignaciones As New DataSet1TableAdapters.asignacionesTableAdapter
            Dim tablasalici As New DataSet1TableAdapters.solicitudesTableAdapter
            Dim asignacionid As Integer = (tablaasignaciones.ScalarQuerySumaTodasLasAsignaciones() + 1)
            Dim query1 As String = String.Format("INSERT INTO asignaciones(usuarioid, fecha, descripcion, solicitudid ,asignacionid) values('{0}','{1}','{2}','{3}','{4}')",
                                       userid,
                                       fecha,
                                       "Ninguno",
                                       Solicitudid,
                                       asignacionid)
            Dim con As New Devart.Data.PostgreSql.PgSqlConnection(seguridad.conexion) ' hacemos la conexion , pero la traemos desde clase seguridad
            con.Open()
            Dim Ejec1 As New Devart.Data.PostgreSql.PgSqlCommand(query1, con)
            Ejec1.ExecuteNonQuery()
            con.Close()
            tablasalici.UpdateQueryEstadoEnProceso("En proceso", Solicitudid)
            ASPxGridView1.DataBind()
        Catch ex As Exception
            ASPxGridView1.DataBind()
        End Try


    End Sub

    Protected Sub ASPxButton2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ASPxButton2.Click

        Try
            Dim tablasolicitu As New DataSet1TableAdapters.solicitudesTableAdapter
            Dim idsolicitud As Integer
            idsolicitud = ASPxGridView1.GetRowValues(ASPxGridView1.FocusedRowIndex, ("solicitudid"))
            tablasolicitu.UpdateQueryPermiso("Requiere permiso", idsolicitud)
            ASPxGridView1.DataBind()
        Catch ex As Exception
            ASPxGridView1.DataBind()
        End Try
       


    End Sub
End Class